package com.cmsky.open.security.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.cmsky.open.security.manager.ActionsInfoManager;
import com.cmsky.open.security.manager.RolesInfoManager;
import com.cmsky.open.security.model.ActionsInfo;
import com.cmsky.open.security.model.RolesInfo;
import com.cmsky.open.security.service.SecurityService;
import com.cmsky.open.security.vo.query.RolesInfoQuery;

@Service("securityService")
public class SecurityServiceImpl implements SecurityService{
	private ActionsInfoManager actionsInfoManager;
	private RolesInfoManager rolesInfoManager;
	
	public void setActionsInfoManager(ActionsInfoManager actionsInfoManager) {
		this.actionsInfoManager = actionsInfoManager;
	}

	public void setRolesInfoManager(RolesInfoManager rolesInfoManager) {
		this.rolesInfoManager = rolesInfoManager;
	}

	public List<RolesInfo> findPage(RolesInfoQuery query) {
		if(null==query){
			return rolesInfoManager.findAll();
		}else
			return (List<RolesInfo>) rolesInfoManager.findPage(query);
	}

	public List<ActionsInfo> findByRoleId(Integer roleId) {
		return this.actionsInfoManager.findByRoleId(roleId);
	}

	public List<ActionsInfo> findAll() {
		return actionsInfoManager.findAll();
	}
}
